{extend name="public/base" /} 
{block name="title"}<title>{$Think.lang.list}</title>{/block} 
{block name="pjax_container"}
<div class="hry-content-wrapper">
<section class="content-header">
    <ol class="breadcrumb">
        <li>会员管理</li>
        <li class="active">题库管理</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="hry-form-wrapper">
                <div class="box-header with-border">
                        {:authAction('Question/create', 'create', ['jid' => $jid])}
                        {:authAction('Question/delete', 'delete_all')}  {include file="public/team_search" /}
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>{$Think.lang.id}{:table_sort('id')}</th>
                            <th>{$Think.lang.question}</th>
                            <th>状态</th>
                            <th width="204">{$Think.lang.action}</th>
                        </tr>
                        {volist name="data" id="vo"}
                        <tr>
                            <td style="vertical-align:middle"><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td style="vertical-align:middle">{$vo.id}</td>
                            <td style="vertical-align:middle"><span class="editable" data-pk="{$vo.id}" data-name="question" data-url="{:url(CONTROLLER_NAME.'/edit', 'id='.$vo['id'])}">{$vo.question}</span></td>
                            <td style="vertical-align:middle">
                                <a href="javascript:void(0);" data-id="{$vo.id}" data-field="is_check" 
                                data-value="{$vo.is_check}" data-url="{:url('edit', 'id='.$vo['id'])}" 
                                class='fa {if condition=" $vo.is_check == 1 "}fa-check-circle text-green{else /}fa-times-circle text-red{/if}'></a>
                            </td>
                            <td style="vertical-align:middle">
                                {:authAction('Question/edit', 'edit', ['qid' => $vo.id,'jid'=>$jid])}
                                {:authAction('Question/delete', 'delete', $vo.id)}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$data->render()}
                </div>
            </div>
        </div>
    </div>
</section>
</div>
<script type="text/javascript">
$(function() {
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });

    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({
        language: "zh-CN"
    });

    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event) {
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event) {
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });

    $('.editable').editable({
        emptytext: "empty",
        params: function(params) { //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON(response);
            if (res.status == 1) {} else {
                return res.info;
            }
        }
    });

    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}